<template>
	<view class="layout">
		<view class="navbar navBarBg">
			<view class="statusbar" :style="{height:STATUS_BAR_HEIGHT+'px'}"></view>
			<view class="titlebar" :style="{height:getTitleBarHeight()+'px',marginLeft:getLeftIcon()+'px'}">
				<view class="title">{{title}}</view>
				<navigator url="/pages/search/search" class="search">
					<uni-icons type="search" color="#888" size="20"></uni-icons>
					<text>搜索</text>
				</navigator>
			</view>
		</view>
		
		<!-- 为了不让用户自定义的navbar不覆盖每个页面的内容区域，设置填充区域，往下进行压一下 -->
		<view class="fill" :style="{height:getNavBarHeight()+'px'}"></view>
	</view>
</template>

<script setup>
 import {STATUS_BAR_HEIGHT,getTitleBarHeight,getNavBarHeight,getLeftIcon} from '@/utils/system';

 defineProps({
	 title:{
		 type:String,
		 default:"标题栏"
	 }
 })

</script>

<style lang="scss" scoped>
.layout {
	
	.navbar{
		padding: 0 30rpx;
		position: fixed;
		top:0;
		left:0;
		width: 100%;
		z-index: 10;
		.statusbar{}
		.titlebar{
			display: flex;
			align-items: center;
			.title {
				font-size: 44rpx;
				font-weight: 700;
			}
			.search{
				border-radius: 60rpx;
				width:240rpx;
				background: rgba(255,255,255,0.4);
				border:1px solid #fff;
				margin-left:10rpx;
				padding:2rpx 10rpx;
				color:#999;
				display:flex;
				align-items: center;
				text{
					
				}
				
			}
		}
	}
	.fill{
		
	}
}
</style>